<template>
	<view>
		<topbar title="提现记录" jt_c="2" background="background:#222222;color:#fff;"></topbar>

		<view class="content">
			<view class="top dis_f_co">
				<view class="dis_f_sb">
					<view class="dis_f_co">
						<view style="margin-bottom: 6rpx;">当前零钱</view>
						<view class="title">{{user.money}}</view>
						<view class="ck_btn dis_f_c_c" @click="go_tx">提现</view>
						<view>累计收益: {{user.moremoney}}</view>
					</view>
					
					
					<view class="dis_f_co">
						<view style="margin-bottom: 6rpx;">当前金币</view>
						<view class="title">{{user.currency}}</view>
						<view class="ck_btn dis_f_c_c" @click="go_cz">充值</view>
					</view>
				</view>
			</view>
			<view class="bottom">
				<view class="txjl dis_f_sb_c" v-for="(item,index) in lists">
					<view class="sj">{{item.create_time}}</view>
					<view class="sj">{{item.statustitle}}</view>
					<view class="je">-{{item.money}}</view>
				</view>
			</view>
			<view style="padding-bottom: 100rpx;">
				<u-loadmore :status="status"/>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [{
					name: '零钱'
				}, {
					name: '金币'
				}, ],
				current: 0,
				hy_level: true,
				user:[],
				lists:[],
				zys:'',
				page:1,
				status:'loadmore',
			};
		},
		
		onShow() {
			this.$.ajax(1, 'post', 'index/checktokens', {
				uid:uni.getStorageSync('uid'),
				token:uni.getStorageSync('token')
			}, (res) => {
				console.log(res)
				if(res.code == 9){
					this.$.ti_shi('token已过期，请重新登陆')
				uni.clearStorageSync()
					setTimeout( () => {
						uni.navigateTo({
							url:'/pages/login/login'
						})
					}, 1000)
				return;
				}
				else{
				this.$.ajax(1, 'post', 'index/getuser', {
				uid:uni.getStorageSync('uid'),
				token:uni.getStorageSync('token')
			}, (res) => {
				console.log(res)
				if(res.code == 1){
				this.user = res.userinfo
				}
				
			})
			
				}
			})
			this.page = 1;
			this.lists = [];
			this.get_list();
		},
		methods: {
			get_list () {
				this.$.ajax(1, 'post', 'index/gettixianlog', {
					uid:uni.getStorageSync('uid'),
					token:uni.getStorageSync('token'),
					page:this.page,
				}, (res) => {
					console.log(res)
					if(res.code == 1){
					// this.lists = res.list
					this.zys = res.pagecount
						res.list.forEach((item,index)=>{
							this.lists.push(item);
						})
					}else{
						this.status = 'nomore';
					}
					
				})
			},
			change(index) {
				this.current = index;
			},
			go_tx() {
				
				this.$.open('/pages/mine/ti_xian')
			},
			go_txmx() {
				this.$.open('/pages/mine/tx_mx')
			},
			go_cz(){
				this.$.open('/pages/mine/ti_xian?cz='+1)
			},
			
		},
		onReachBottom() {
			// var xiabiao = this.current;
			if(this.page+1 <= this.zys){
				this.status = 'loading';
				this.page = ++this.page;
				console.log(this.page)
				this.get_list();
			}else{
				this.status = 'nomore';
				return;
			}
		}
	}
</script>

<style lang="scss">
	.tg_bz {
		position: fixed;
		z-index: 999;
		font-size: 22rpx;
		line-height: 32rpx;
		top: calc(var(--status-bar-height) + 30rpx);
		right: 48rpx;
		color: #fff;

		image {
			width: 34rpx;
			height: 34rpx;
			margin-right: 6rpx;
		}

	}

	.content {
		width: 100%;
		padding: 0 24rpx 0 24rpx;
		top: calc(var(--status-bar-height) + 124rpx);

		z-index: 998;
		position: absolute;

		.top {
			width: 100%;
			padding: 36rpx 56rpx 20rpx 48rpx;
			height: 318rpx;
			position: relative;
			background-image: url(../../static/mine/qbbg.png);
			background-size: 100% 100%;
			// padding: 36rpx 0 24rpx 48rpx;
			margin-bottom: 44rpx;
			color: #fff;

			.title {
				font-size: 72rpx;
				line-height: 100rpx;
				margin-bottom: 12rpx;
			}
		}

		.text1 {
			font-size: 22rpx;
			line-height: 32rpx;
			margin-bottom: 14rpx;
		}

		.text2 {
			font-size: 34rpx;
			line-height: 48rpx;
			margin-bottom: 14rpx;
		}

		.ck_btn {
			width: 144rpx;
			height: 50rpx;
			border-radius: 30rpx;
			background-color: #E23C63;
			margin-bottom: 24rpx;
			font-size: 22rpx;
		}


		.bottom {
			width: 100%;
			padding: 22rpx 24rpx;
			background-color: #fff;
			box-shadow: 0rpx 6rpx 24rpx rgba(34, 34, 34, 0.05);
			border-radius: 20rpx;
			.txjl{
				width: 100%;
				padding: 24rpx 0;
				border-bottom: 2rpx solid #EEEEEE;
			}
			.sj{
				font-size: 28rpx;
				line-height: 40rpx;
			}
			.je{
				font-size: 36rpx;
				color: #E23C63;
				line-height: 50rpx;
				font-weight: bold;
			}
		}
		.bottom .txjl:last-child{
			border-bottom: none;
		}
	}
</style>
